package com.bwie.controller;

import com.bwie.pojo.ServiceItem;
import com.bwie.pojo.ServiceType;
import com.bwie.service.ServiceItemService;
import com.bwie.service.ServiceTypeService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @projectName: day0711
 * @package: com.bwie.controller
 * @className: ItemController
 * @author: 杨珂
 * @description: TODO
 * @date: 2025/7/11 14:33
 * @version: 1.0
 */
@RestController
@RequestMapping("/item/index")
public class ItemController {


    @Autowired
    ServiceItemService serviceItemService;

    @Autowired
    ServiceTypeService typeService;


    @PostMapping("/getServerItemList")
    public R getServerItemList(@RequestBody PageInfoVo pageInfoVo) {
        return serviceItemService.getServerItemList(pageInfoVo);
    }

    @PostMapping("/getServiceTypeList")
    public R getServiceTypeList() {
        return typeService.getServiceTypeList();
    }


    @PostMapping("/uploadImage")
    public R uploadImage(@RequestPart("file") MultipartFile file) {
        return serviceItemService.uploadImage(file);
    }


    @PostMapping("/add")
    public R add(@RequestBody ServiceItem serviceItem) {
        return serviceItemService.add(serviceItem);
    }


}
